export const getShowByIds = function (data, callback) {
	$.ajax({
		url: `/api/get/works/ids/${data.point}`,
		type: "get",
		data: data,
		async: true,
		success: function (data) {
			callback(data);
		}
	});
}
export const getShow = function (data, callback) {
	$.ajax({
		url: '/api/get/works/'+data.point,
		type: "get",
		data: data,
		async: true,
		success: function (data) {
			callback(data);
		}
	});
}
export const getComments = function (data, callback){
	$.ajax({
		url : `/api/get/comments/${data.type}/${data.wid}/${data.fid}/${data.start}/${data.num}`,
		type : "get",
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
export const addComment = function(data, callback){
	$.ajax({
		url : `/uaction/insert/comment`,
		type : "post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		data:data,
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
export const getWork = function(data, callback){
	$.ajax({
		url : `/api/get/work/${data.point}/${data.id}`,
		type : "get",
		data:data,
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
/**
 * 
 * @param {*} data 
 * @param {*} callback 
 */
export const actWork = function(data, callback){
	$.ajax({
		url : `/uaction/act/work/${data.point}/${data.wid}/${data.act}`,
		type : "post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		async : true,
		success : function(data) {
			callback(data);

		}
	});
	
}
/**
 * 详细内容
 * @param {table,id} data 
 * @param {*} callback 
 */
 export const getDetail = function(data, callback){
	$.ajax({
		url : `/veapi/detail/vehicle/${data.table}/${data.id}`,
		type : "get",
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
/**
 * 搜索内容
 * @param {point,start,num,keys} data 
 * @param {*} callback 
 */
export const search = function(data, callback){
	$.ajax({
		url : `/veapi/search/vehicle/${data.table}`,
		type : "get",
		data:data,
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
/**
 * 获取订单
 * @param {point,start,num,keys} data 
 * @param {*} callback 
 */
 export const selOrder = function(data, callback){
	$.ajax({
		url : `/veapi/get/order`,
		type : "get",
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const addOrder = function(data, callback){
	$.ajax({
		url : `/veapi/insert/order`,
		type : "post",
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const editOrder = function(data, callback){
	let id = data.id;
	delete data.id;
	$.ajax({
		url : `/veapi/update/order/${id}`,
		type : "post",
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const Login = function(data, callback){
	$.ajax({
		url : `/veapi/user/login`,
		type : "post",
		data:data,
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
export const Regist = function(data, callback){
	$.ajax({
		url : `/veapi/user/regist`,
		type : "post",
		data:data,
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
	/**
 * 
 * @param {point,keys} data 
 * @param {*} callback 
 */
// export const getTotal = function(data, callback){
// 	$.ajax({
// 		url : `/api/get/num/total/${data.point}`,
// 		type : "get",
// 		data:{key:data.key},
// 		async : true,
// 		success : function(data) {
// 			callback(data);

// 		}
// 	});
// }

export const getHotKeys = function(data, callback){
	$.ajax({
		url : `/api/get/keywords/${data.start}/${data.num}/${data.key}`,
		type : "get",
		async : true,
		success : function(data) {
			callback(data);

		}
	});
}
export const getUser = function(data,callback){
	$.ajax({
		url:`/api/get/user/${data.id}`,
		type:"get",
		async: true,
		success: function (data) {
			callback(data);
		}
	})
}
export const setUserPassword = function(data,callback){
	$.ajax({
		url : `/uaction/set/userpassword`,
		type : "post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const updateUser = function(data,callback){
	$.ajax({
		url : `/uaction/set/user`,
		type : "post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const updateUserSafe = function(data,callback){
	$.ajax({
		url : `/uaction/set/safe/user`,
		type : "post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		data:data,
		async : true,
		success : function(data) {
			callback(data);
		}
	});
}
export const followUser = function(data,callback){
	$.ajax({
		url:`/uaction/act/user/${data.tid}/${data.act}`,
		type:"post",
		headers: {
			Authorization:  window.localStorage.getItem("token")
		},
		async: true,
		success: function (data) {
			callback(data);
		}
	})
}